home *** CD-ROM | disk | FTP | other *** search
- /* vbl.c
- This is the VBL dcmd.
-
- Copyright © 1988 Apple Computer, Inc. All rights reserved.
-
- Modification history:
- 2Dec88 sad written from VCB.
-
- The following MPW commands will build the dcmd and copy it to the
- "Debugger Prefs" file in the System folder. The dcmd's name in
- MacsBug will be the name of the file built by the Linker.
- You must first copy dcmd.h, dcmdGlue.a.o and DRunTime.o from the
- C Samples folder into this folder.
-
- C Put.c
- C VBL.c
- Link dcmdGlue.a.o VBL.c.o put.c.o DRuntime.o "{Libraries}"Interface.o -o VBL
- BuildDcmd VBL 1001
- Echo 'include "VBL";' | Rez -a -o "{systemFolder}Debugger Prefs"
- */
-
- #include <Types.h>
- #include <OSUtils.h>
- #include <Retrace.h>
-
- #include "dcmd.h"
- #include "put.h"
-
- #define VBLQueue ((QHdrPtr)0x160)
-
-
- static void DrawHdr()
- {
- // 1 2 3 4 5 6 7
- // 1234567890123456789012345678901234567890123456789012345678901234567890
- dcmdDrawLine("\p Addr Count Phase VBL at");
- }
-
-
- static void DrawVBL(VBLTask* vblp)
- {
- PutUHexZTo((unsigned long)vblp->vblAddr,6,8);
- PutSpace();
- PutSpace();
- PutUHexWord(vblp->vblCount);
- PutSpace();
- PutSpace();
- PutUHexWord(vblp->vblPhase);
- PutSpace();
- PutUHexZTo((unsigned long)vblp,6,27);
- PutLine();
- }
-
-
- pascal void CommandEntry(dcmdBlock* paramPtr)
- {
- switch (paramPtr->request)
- {
- case dcmdInit:
- break;
-
- case dcmdHelp:
- dcmdDrawLine("\pvbl");
- dcmdDrawLine("\p Displays vertical retrace information.");
- break;
-
- case dcmdDoIt:
- {
- VBLTask* vblp;
- int numvbls = 0;
-
- dcmdSwapWorlds();
-
- dcmdDrawLine("\pDisplaying VBL tasks");
-
- if (VBLQueue->qFlags & 0x4000)
- dcmdDrawLine("\pVBLs executing");
- else dcmdDrawLine("\pVBLs inactive");
-
- // get low-memory values after dcmdSwapWorlds()
- vblp = (VBLTask*)(VBLQueue->qHead);
-
- DrawHdr();
- while (vblp)
- {
- DrawVBL(vblp);
- numvbls++;
- if (paramPtr->aborted) break;
- if (vblp->qLink == 0)
- if (vblp != (VBLTask*)(VBLQueue->qTail))
- dcmdDrawLine("\pVBL queue does not end at VBLQueue.qTail");
- vblp = (VBLTask*)vblp->qLink;
- }
-
- PutUDec(numvbls);
- PutPStr("\p VBL tasks");
- PutLine();
-
- dcmdSwapWorlds();
- }
- break;
-
- default:
- PutPStr("\punknown request ");
- PutUDec(paramPtr->request);
- PutLine();
- break;
- }
- } // CommandEntry
-